package com.ymatou.iapi.godmch.service;

import java.util.ArrayList;

import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.godmch.parameter.AgentInfo;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*查询买家邀请码Call
*FreeMaker Template自动生成代码
*/
public class getBuyerInviteCodeInfoCall extends YmatouBaseCall{
	private static String opurl ="api/buyercode/getBuyerInviteCodeInfo";
	
	public getBuyerInviteCodeInfoCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	public String getStatusCode1()
	{
	  return getString("status");
	}
	
	 public String getMessage()
	{
	 return getString("msg");
	}
	public boolean getSuccess() throws JSONException
	{
	  return new JSONObject(getString("result").toString()).getBoolean("success");
	}
	
	public Integer getCsId() {
		Integer result=0;
		try {
			result =  getJsonObject().get("result").getAsJsonObject().get("csId").getAsInt();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
	public Integer getMchId() {
		Integer result=0;
		try {
			result =  getJsonObject().get("result").getAsJsonObject().get("mchId").getAsInt();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
	
	
	public String getInviteCode() {
		String result="";
		try {
			result =  getJsonObject().get("result").getAsJsonObject().get("inviteCode").getAsString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}
}